﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WISD.CarFriend.Model;

namespace WISD.CarFriend.Web.Module.Introduction
{
    public partial class IntroductionContent : System.Web.UI.Page
    {
        #region 字段
        private string m_IntroTitle = string.Empty;
        private string m_BodyID = string.Empty;
        private string m_IntroContent = string.Empty;
        private int m_ID;
        private WISD.CarFriend.BLL.Web.IntroductionManageModule m_IntroManageModuleBLL
            = new BLL.Web.IntroductionManageModule();
        #endregion


        #region 属性
        /// <summary>
        /// IntroTitle
        /// </summary>
        public string IntroTitle
        {
            get { return this.m_IntroTitle; }
            set { value = this.m_IntroTitle; }
        }


        /// <summary>
        /// BodyID
        /// </summary>
        public string BodyID
        {
            get { return this.m_BodyID; }
            set { value = this.m_BodyID; }
        }


        /// <summary>
        /// IntroContent
        /// </summary>
        public string IntroContent
        {
            get { return this.m_IntroContent; }
            set { value = this.m_IntroContent; }
        }
        
        #endregion


        #region 事件
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!int.TryParse(Request.Params["id"].ToString(), out this.m_ID))
                {
                    this.m_ID = 1;
                }

                if (!Page.IsPostBack)
                {
                    this.ShowContent();
                }
            }
            catch (Exception exception)
            {
                Session["WebErrorInfo"] = exception.Message.ToString();
                Response.Redirect("/Error.aspx");
            }
        }
        #endregion


        #region 方法
        /// <summary>
        /// 显示内容
        /// </summary>
        private void ShowContent()
        {
            T_CF_Web_Introduction introInfo = this.m_IntroManageModuleBLL.GetIntroductionByID(this.m_ID);
            this.m_IntroTitle= introInfo.Title;
            this.m_IntroContent = introInfo.WebContent;

            switch (this.m_ID)
            {
                case 1:
                    this.m_IntroTitle = "俱乐部介绍";
                    this.m_BodyID = "club";
                    break;
                case 2:
                    this.m_IntroTitle = "服务项目";
                    this.m_BodyID = "service";
                    break;
                case 3:
                    this.m_IntroTitle = "极道改装";
                    this.m_BodyID = "car";
                    break;
                case 4:
                    this.m_IntroTitle = "会员细则区";
                    this.m_BodyID = "user";
                    break;
                case 5:
                    this.m_IntroTitle = "联系我们";
                    this.m_BodyID = "contact";
                    break;
                default:
                    Session["WebErrorInfo"] = "未知页面信息类型。";
                    Response.Redirect("/Error.aspx");
                    break;
            }
        }
        #endregion


    }
}